package com.fyzk.adapter;

import android.text.Html;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.fyzk.activity.lottery.recommend_order.MyRecommendOrderBean;
import com.tyjc.lottery.R;

/**
 * @author yangfeng
 * @create 2018/10/12 13:12
 * @Describe
 */
public class BetDetailsAdapter extends BaseQuickAdapter<MyRecommendOrderBean.DetailBean.RaceBetcodeBean, BaseViewHolder> {

    public BetDetailsAdapter() {
        super(R.layout.item_bet_details);
    }

    @Override
    protected void convert(BaseViewHolder helper, MyRecommendOrderBean.DetailBean.RaceBetcodeBean item) {
        helper.setText(R.id.tv_time, item.getOfficialWeekDay() + item.getMatchNum())
                .setText(R.id.tv_home_court, item.getHomeTeam())
                .setText(R.id.tv_visiting_field, item.getAwayTeam())
                .setText(R.id.tv_type, item.getMatchName())
                .setGone(R.id.tv_type, false)
        ;
        StringBuilder betCodes = new StringBuilder();   // 投注内容
        for (int j = 0; j < item.getContents().size(); j++) {
            if (j > 0)
                betCodes.append(",");
            betCodes.append(item.getContents().get(j).getBetcode());
        }
        helper.setText(R.id.tv_result, Html.fromHtml(betCodes.toString(), null, null));
    }
}
